/*
Auhtor      : Andrey Volosevich
Company     : Fujitsu America
Created Date: 05 Oct-2009
Description : Trigger prevents deletion of Contact record based on the User Profile 
*/

trigger preventContactDelete on Contact (before delete) {
	
	Profile curUserProfile = [Select Name from Profile where Id =: UserInfo.getProfileId()];
	
	if(Label.IM_Admin_Profiles != null && !Label.IM_Admin_Profiles.contains(curUserProfile.Name)){//Checking current user profile with white listed profiles.
		for(Integer i=0; i<Trigger.old.size(); i++){
				Trigger.old[0].addError('Insufficient privileges to delete Contact.');
		}
	}
}